<%--
  Created by IntelliJ IDEA.
  User: asus
  Date: 2019/12/20
  Time: 11:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="dao.itemDao" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="enity.Items" %>
<style type="text/css">
    img:hover{
        width: 300px;
        height: 300px;
    }


</style>

<html>
  <head>
    <title>商品</title>
  </head>
  <body>
     <table align="center" width="750" border="0" cellspacing="0">

                 <!--开始循环-->
       <%
            itemDao dao=new itemDao();   //新建业务层逻辑类
            ArrayList<Items> list=dao.getAllItems();   //获取商品结果集
            if(list!=null&&list.size()>0){
              for(int i=0;i<list.size();i++){
                Items items=list.get(i);      //获取单个商品对象
         %>
         <tr>
             <td>

            <div>
               <a href="details.jsp?id=<%=items.getId()%>" target="_blank"><img src="image/<%=items.getPicture()%>" width="200" height="200"></a><br>
               <%=items.getName()%><br>
               价格:<%=items.getPrice()%><br>
               剩余库存:<%=items.getNumber()%> 产地:<%=items.getCity()%><br>
            </div>
 <!--循环结束-->

  <%
          }%>
             </td>
         </tr>
                     <%
    }
  %>


     </table>
  </body>
</html>
